﻿Ext.ns('Ext.mc');



Ext.mc.Result_Grid= Ext.extend(Ext.grid.GridPanel,{
	initialized:false,
	layout:'fit',
	loadMask : true,
	cm : new Ext.grid.ColumnModel([new Ext.grid.RowNumberer(), {
			header : '项目编号',
			dataIndex : 'projectnumber',
			width : 70,
		}, {
			header : '项目名称',
			dataIndex : 'projectname',
			width : 100
		}, {
			header : '主承办单位',
			dataIndex : 'undertakefnit',
			width : 80
		}, {
			header : '审核标志',
			dataIndex : 'auditmark',
			width : 80,
			renderer : function(value){
				var a ="";
				if(value == 0){
					a = "未审核";
				}else 
					a = "已审核";
				return a;
		}
		},{
			header:'查看详情',
			dataIndex:'filingdate',
			width:80,
			renderer:function(value, cellmeta, record, rowIndex, columnIndex, store){
			
				var brow="mid_detail('"+record.get('projectnumber')
						+"','"+record.get('projectname')
						+"','"+record.get('inventpatentapplication')
						+"','"+record.get('inventpatentauthorization')
						+"','"+record.get('usenewapplication')
						+"','"+record.get('usenewauthorization')
						+"','"+record.get('appearancedesignapplication')
						+"','"+record.get('appearancedesignauthorization')
						+"','"+record.get('foreignpatent')
						+"','"+record.get('newtechnology')
						+"','"+record.get('newproduct')
						+"','"+record.get('newmaterial')
						+"','"+record.get('newequipment')
						+"','"+record.get('computersoftware')
						+"','"+record.get('paper')
						+"','"+record.get('technologystandard')
						+"','"+record.get('nationalaward')
						+"','"+record.get('provincialaward')
						+"','"+record.get('cityaward')
						+"','"+record.get('doctor')
						+"','"+record.get('master')
						+"','"+record.get('undergraduate')
						+"','"+record.get('fundsavailable')
						+"','"+record.get('fundsinvestment')
						+"','"+record.get('benefitacquired')
						+"','"+record.get('projectsummary')+"');return false;";
						
				var b = ' <a  onclick="'+brow+'">查看</a>&nbsp;';
			return b;
		}
		}
		]),
	store: new Result_GridStore(),
	initComponent:function(){
		this.tbar = [
//		             {
//			xtype:'label',
//			text:'名称'
//		},{
//			type:'textfield',
//			id:this.id+"name",
//		},'-',{
//			xtype:'button',
//			text:'查询',
//			handler : function(b,e){}
//			
//		}
		];
		this.bbar = new Ext.PagingToolbar({
			pageSize : 20,
			store : this.store,
			displayInfo : true,
			displayMsg : '显示 {0}-{1}条 / 共 {2} 条',
			emptyMsg : "无数据。",
			plugins        : [new Ext.ux.PageSizePlugin()],
			items : ['-']
		});
		Ext.mc.Result_Grid.superclass.initComponent.call(this)
	}
})

function mid_detail(number,name,patent1,patent2,use1,
					use2,appear1,appear2,foreign,new1,
					new2,new3,new4,computer1,paper,tech,national,
					province,city,doctor,master,under,
					fund1,fund2,benefit,summary){

	
	var a = Ext.getCmp('mid_window');//判断windows是否存在
	if(a == null){ //如果不存在 则new 一个
		a = new Ext.mc.ShowWindow({
			id:'mid_window',
			closable : true
		});
	}
	//进行一些必要的赋值
	a.findById('mid_windowprojectnumber').setValue(number);
	a.findById('mid_windowprojectname').setValue(name);
	a.findById('mid_windowinventpatentapplication').setValue(patent1);
	a.findById('mid_windowinventpatentauthorization').setValue(patent2);
	a.findById('mid_windowusenewapplication').setValue(use1);
	a.findById('mid_windowusenewauthorization').setValue(use2);
	a.findById('mid_windowappearancedesignapplication').setValue(appear1);
	a.findById('mid_windowappearancedesignauthorization').setValue(appear2);
	a.findById('mid_windowforeignpatent').setValue(foreign);
	a.findById('mid_windownewtechnology').setValue(new1);
	a.findById('mid_windownewproduct').setValue(new2);
	a.findById('mid_windownewmaterial').setValue(new3);
	a.findById('mid_windownewequipment').setValue(new4);
	a.findById('mid_windowcomputersoftware').setValue(computer1);
	a.findById('mid_windowpaper').setValue(paper);
	a.findById('mid_windowtechnologystandard').setValue(tech);
	a.findById('mid_windownationalaward').setValue(national);
	a.findById('mid_windowprovincialaward').setValue(province);
	a.findById('mid_windowcityaward').setValue(city);
	a.findById('mid_windowdoctor').setValue(doctor);
	a.findById('mid_windowmaster').setValue(master);
	a.findById('mid_windowundergraduate').setValue(under);
	a.findById('mid_windowfundsavailable').setValue(fund1);
	a.findById('mid_windowfundsinvestment').setValue(fund2);
	a.findById('mid_windowbenefitacquired').setValue(benefit);
	a.findById('mid_windowprojectsummary').setValue(summary);
	
	a.show();
}